﻿using System;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using MyFavorites.Model;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string UserName = Page.RouteData.Values["UserName"] as string;
        Page.Title = UserName + " LoginName:" + HttpContext.Current.User.Identity.Name;

        if (!Page.IsPostBack)
        {
            if (Request.IsAuthenticated)
            {
                HttpCookie cookie = Request.Cookies[FormsAuthentication.FormsCookieName];
                FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(cookie.Value);
                txtMsg.Text = ticket.UserData;
            }
        }

        using (Entities entitie = new Entities())
        {
        }
    }
    protected void btnLoginOut_Click(object sender, EventArgs e)
    {
        FormsAuthentication.SignOut();
        Response.Redirect("~/Login.aspx");
    }
}